home *** CD-ROM | disk | FTP | other *** search
Makefile | 1994-06-30 | 7.6 KB | 233 lines |
- ##
- ## Build shared library for Scheme->C and versions of sci and sccomp which
- ## use the shared libraries.
- ##
- ## Built under ISC 386/ix 2.0.2 with the host based tcp/ip package
- ## and the software development package, but using gcc as compiler.
- ##
- ## First, make port in scrt and scsc to build libsc.a and the objects for
- ## sccomp. The CFLAGS used to compile scrt/scinit.c must include -DI386SHLIB
- ## but all the other objects are the same as the ones used for the unshared
- ## libraries.
- ##
- ## Second, edit the directory names in this file to reflect your own system
- ## conventions.
- ##
- ## Third, if you aren't using gcc, then find the lines marked NO-GCC and
- ## fix them according to the supplied instructions.
- ##
- ## Third and a half - stiff upper lip - become root and use emacs to edit
- ## /usr/lib/libinet.a. There are three modules which define errno as Common
- ## rather than Undefined and we need to fix them. Search for the string
- ## errno^@^@^@^D
- ## with ^S, remembering that the ^@ and ^D will need to be quoted with ^Q.
- ## Delete the ^D and insert a ^@ in its place. You need to do this three
- ## times, then write the file out with ^X^S. (You might want to make an extra
- ## backup of libinet.a before you do this. :-) Finally, you should run
- ## ranlib, ie ar rs, on the updated archive to get its symbol table fixed.
- ##
- ## Fourth, try make all to see if everything comes together correctly.
- ## The library build makes subdirectories and extracts needed objects
- ## from archives. This can take up a lot of space, but not nearly as
- ## much as the shared x11 libraries will.
- ##
- ## Fifth, become a privileged user and try make install. Note that
- ## sci_s and sccomp_s will not run until the target shared library has
- ## been installed in its declared home. So make sure that #target
- ## specifies a directory that you can modify.
- ##
-
- #NO-GCC then change this macro to use cc
- CC=gcc
-
- BINDIR = /usr/local/bin
- LIBDIR = /usr/local/lib
- CPUDIR = /home/28sep90~
-
- #NO-GCC then delete gnulib from this list
- libraries = libsc libinet libm libc gnulib
-
- libsc_a = ${CPUDIR}/scrt/libsc.a
- libinet_a = /usr/lib/libinet.a
- libm_a = /lib/libm.a
- libc_a = /lib/libc.a
- gnulib_a = ${LIBDIR}/gcc-gnulib
- libc_s_a = /lib/libc_s.a
-
- sci_o = ../scrt/sci.o
-
- sccomp_o= ../scsc/main.o ../scsc/closeana.o ../scsc/lambdaexp.o\
- ../scsc/plist.o ../scsc/transform.o ../scsc/expform.o\
- ../scsc/readtext.o ../scsc/miscexp.o ../scsc/macros.o\
- ../scsc/compile.o ../scsc/lap.o ../scsc/gencode.o\
- ../scsc/callcode.o ../scsc/lambdacode.o ../scsc/misccode.o
-
- all: sci_s sccomp_s libsc_s
-
- sci_s: ${sci_o} libsc_s
- ${CC} -o sci_s ${sci_o} libsc_s.a -lc_s
- @echo target shared library must be installed before sci_s can run.
-
- sccomp_s: ${sccomp_o} libsc_s
- ${CC} -o sccomp_s ${sccomp_o} libsc_s.a -lc_s
- @echo target shared library must be installed before sccomp_s can run.
-
- install: all
- -mkdir ${LIBDIR}/schemetoc
- -rm ${LIBDIR}/schemetoc/libsc_s
- cp libsc_s ${LIBDIR}/schemetoc
- strip ${LIBDIR}/schemetoc/libsc_s
- -rm ${LIBDIR}/schemetoc/libsc_s.a
- -rm ${LIBDIR}/schemetoc/libsc.a
- cp libsc_s.a ${LIBDIR}/schemetoc/libsc_s.a
- ln ${LIBDIR}/schemetoc/libsc_s.a ${LIBDIR}/schemetoc/libsc.a
- -rm ${BINDIR}/sci_s
- -rm ${BINDIR}/sci
- cp sci_s ${BINDIR}/sci_s
- ln ${BINDIR}/sci_s ${BINDIR}/sci
- strip ${BINDIR}/sci_s
- cp ${CPUDIR}/scrt/predef.sc ${LIBDIR}/schemetoc
- cp ${CPUDIR}/scrt/objects.h ${LIBDIR}/schemetoc
- -rm ${BINDIR}/sccomp_s
- -rm ${BINDIR}/sccomp
- cp sccomp_s ${BINDIR}
- ln ${BINDIR}/sccomp_s ${BINDIR}/sccomp
- strip ${BINDIR}/sccomp_s
- ${BINDIR}/sccomp_s \
- -sch 4 \
- ${LIBDIR}/schemetoc/predef.sc \
- ${LIBDIR}/schemetoc/objects.h \
- ${LIBDIR}/schemetoc/libsc_s.a \
- ${LIBDIR}/schemetoc/libsc_s.a \
- I386 \
- ${LIBDIR}/schemetoc/sccomp_s.heap
- chmod +r ${LIBDIR}/schemetoc/sccomp_s.heap
- chmod -x ${LIBDIR}/schemetoc/sccomp_s.heap
- -rm ${BINDIR}/scc
- echo "#!/bin/sh" > ${BINDIR}/scc
- echo SCC=${BINDIR}/sccomp >> ${BINDIR}/scc
- echo SCH=${LIBDIR}/schemetoc/sccomp_s.heap >> ${BINDIR}/scc
- echo LIB='"'${LIBDIR}/schemetoc/libsc_s.a -lc_s'"' >> ${BINDIR}/scc
- echo '$${SCC} -cc $${CC} -schf $${SCH} $$* $${LIB}' >> ${BINDIR}/scc
- chmod +x ${BINDIR}/scc
-
- ##
- ## Interpreter runtime library modules.
- ##
- libsc = libsc/apply.o libsc/callcc.o libsc/cio.o libsc/heap.o\
- libsc/objects.o libsc/scdebug.o libsc/sceval.o libsc/scexpand.o\
- libsc/scexpand1.o libsc/scexpand2.o libsc/scinit.o libsc/scqquote.o\
- libsc/screp.o libsc/scrt1.o libsc/scrt2.o libsc/scrt3.o libsc/scrt4.o\
- libsc/scrt5.o libsc/scrt6.o libsc/scrt7.o libsc/signal.o
-
- ##
- ## Additional libinet support.
- ##
- libinet = libinet/bcopy.o libinet/bzero.o libinet/connect.o\
- libinet/byteorder.o libinet/ghostnamad.o libinet/ghostname.o\
- libinet/inet_addr.o libinet/select.o libinet/setsockopt.o libinet/socket.o\
- libinet/bcmp.o libinet/res_comp.o libinet/res_mkqury.o libinet/res_send.o\
- libinet/sockack.o libinet/recv.o libinet/res_init.o libinet/send.o
-
- ##
- ## Math library modules.
- ##
- libm = libm/floor.o libm/exp.o libm/log.o libm/sin.o libm/tan.o libm/asin.o\
- libm/atan.o libm/sqrt.o libm/pow.o libm/matherr.o
-
- ##
- ## C library modules not in shared c library.
- ##
- libc = libc/setjmp.o libc/poll.o libc/printf.o libc/abort.o\
- libc/scanf.o libc/modf.o libc/doscan.o libc/ctype.o\
- libc/link.o libc/geteuid.o libc/mknod.o\
- libc/rew.o libc/strtol.o libc/sysi86.o\
- libc/errlst.o libc/tolower.o \
- libc/data.o libc/cuexit.o \
- libc/putmsg.o libc/uname.o libc/getmsg.o
-
- ##
- ## Gnu c compiler run time support modules.
- ##
- gnulib = gnulib/_divsi3.o gnulib/_fixdfsi.o gnulib/_fixunsdfsi.o\
- gnulib/_muldi3.o gnulib/_moddi3.o gnulib/_cmpdi2.o gnulib/_negdi2.o\
- gnulib/_umoddi3.o gnulib/_bdiv.o gnulib/_udivsi3.o
-
- ##
- ## The whole kit
- ##
- #NO-GCC then delete ${gnulib} from this list
- library_objects = ${libsc} ${libinet} ${libm} ${local} ${libc} ${gnulib}
- ##
- ## Scheme interpreter runtime library.
- ##
- libsc_s: libsc.sl
- -rm libsc_s libsc_s.a
- mkshlib -s libsc.sl -t libsc_s -h libsc_s.a 2> libsc.err
- libsc.sl: libsc.o
- echo '##' > libsc.sl
- echo '## libsc.sl - scheme->c library' >> libsc.sl
- echo '#address .text 0xB0000000' >> libsc.sl
- echo '#address .data 0xB0400000' >> libsc.sl
- echo '#target ${LIBDIR}/schemetoc/libsc_s' >> libsc.sl
- echo '#branch' >> libsc.sl
- nm -px libsc.o |\
- sort |\
- nawk '/ T .*__init/{print " " $$3 " " ++nbt}'>> libsc.sl
- echo '#objects' >> libsc.sl
- echo ' libsc.o' >> libsc.sl
- echo '#objects noload' >> libsc.sl
- echo /lib/libc_s.a >> libsc.sl
- echo '#init libsc.o' >> libsc.sl
- echo ' sc__etext etext' >> libsc.sl
- echo '#hide linker *' >> libsc.sl
- echo '#export linker' >> libsc.sl
- nm -px libsc.o |\
- sort |\
- nawk '/ [DT] /{print " " $$3}' >> libsc.sl
-
- libsc.o: ${libraries} ${library_objects}
- ld -x -r -o tmp.o ${library_objects}
- nm -p tmp.o | \
- nawk '/ C /{ print "int " $$3 "[" int(($$1+3)/4) "]={0};" }'\
- > tmp_defs.c
- ${CC} -c tmp_defs.c
- ld -x -r -o libsc.o tmp_defs.o tmp.o
-
- libsc: ${libsc_a}
- -mkdir libsc
- cd libsc; ar x ${libsc_a} `echo ${libsc} | sed s/libsc.//gp`
-
- libinet:
- -mkdir libinet
- cd libinet; ar x ${libinet_a} `echo ${libinet} | sed s/libinet.//gp`
-
- libm: ${libm_a}
- -mkdir libm
- cd libm; ar x ${libm_a} `echo ${libm} | sed s/libm.//gp`
-
- libc: ${libc_a}
- -mkdir libc
- cd libc; ar x ${libc_a} `echo ${libc} | sed s/libc.//gp`
-
- gnulib: ${gnulib_a}
- -mkdir gnulib
- cd gnulib; ar x ${gnulib_a} `echo ${gnulib} | sed s/gnulib.//gp`
-
- libsc.get: libsc.o
- nm -p ${libc_s_a} | nawk '/ A [_a-zA-Z]/{ print $$3 }' | sort > absolute
- nm -p libsc.o | nawk '/ U /{ print $$3 }' | sort > undefined
- comm -13 absolute undefined > libsc.get
-
- ##
- ## Miscellaneous
- ##
- clean:
- -rm libsc.o libsc.err libsc.sl libsc.get
- -rm tmp.o tmp_defs.c tmp_defs.o undefined absolute
- all-clean:
- -rm libsc_s libsc_s.a sci_s sccomp_s
- -rm -fr ${libraries}
-
-
-